package controller

// "myddns/config"
//"github.com/thinkeridea/go-extend/exnet"
import (
	"fmt"
	"net/http"

	"github.com/gin-gonic/gin"
	"github.com/thinkeridea/go-extend/exnet"
)

func init() {
	fmt.Println("package controller init")
}

// Hello
func HelloHandler(c *gin.Context) {
	c.JSON(http.StatusOK, gin.H{
		"message": "Hello Gin",
	})
}

// Test Real IP
func TestRealIPHandler(c *gin.Context) {
	ip := exnet.ClientPublicIP(c.Request)
	if ip == "" {
		ip = exnet.ClientIP(c.Request)
	}

	c.JSON(http.StatusOK, gin.H{
		"message": "真实IP是：" + ip,
	})
}
